/*    */ package com.wzh.action.control.links;
/*    */ 
/*    */ import com.opensymphony.xwork2.ActionContext;
/*    */ import com.opensymphony.xwork2.ActionSupport;
/*    */ import com.wzh.bean.PageView;
/*    */ import com.wzh.bean.QueryResult;
/*    */ import com.wzh.bean.links.FriendLink;
/*    */ import com.wzh.constant.CommonConstant;
/*    */ import com.wzh.service.links.FlinkService;
/*    */ import java.io.Serializable;
/*    */ import javax.annotation.Resource;
/*    */ import org.springframework.stereotype.Controller;
/*    */ 
/*    */ @Controller
/*    */ public class FlinkAction extends ActionSupport
/*    */ {
/*    */   private static final long serialVersionUID = 1L;
/*    */ 
/*    */   @Resource
/*    */   private FlinkService flinkService;
/* 23 */   private int page = 1;
/*    */   private FriendLink flink;
/*    */ 
/*    */   public FriendLink getFlink()
/*    */   {
/* 27 */     return this.flink;
/*    */   }
/*    */ 
/*    */   public void setFlink(FriendLink flink) {
/* 31 */     this.flink = flink;
/*    */   }
/*    */ 
/*    */   public int getPage()
/*    */   {
/* 37 */     return this.page;
/*    */   }
/*    */ 
/*    */   public void setPage(int page) {
/* 41 */     this.page = page;
/*    */   }
/*    */ 
/*    */   public String index()
/*    */   {
/* 46 */     PageView pageView = new PageView(CommonConstant.MAXRESULT, this.page);
/*    */ 
/* 48 */     int firstIndex = (this.page - 1) * CommonConstant.MAXRESULT;
/*    */ 
/* 50 */     QueryResult qr = this.flinkService.getScrollData(firstIndex, CommonConstant.MAXRESULT);
/* 51 */     pageView.setRecords(qr.getResultlist());
/* 52 */     pageView.setTotalrecords((int)qr.getTotalrecord());
/* 53 */     ActionContext.getContext().put("pageView", pageView);
/*    */ 
/* 55 */     return "index";
/*    */   }
/*    */ 
/*    */   public String add()
/*    */   {
/* 60 */     return "add";
/*    */   }
/*    */ 
/*    */   public String insert()
/*    */   {
/* 65 */     this.flinkService.save(this.flink);
/* 66 */     ActionContext.getContext().put("message", "友情链接添加成功");
/* 67 */     ActionContext.getContext().put("urladdress", "/control/flink/index");
/* 68 */     return "message";
/*    */   }
/*    */ 
/*    */   public String edit() {
/* 72 */     this.flink = ((FriendLink)this.flinkService.find(this.flink.getId()));
/* 73 */     return "edit";
/*    */   }
/*    */ 
/*    */   public String update()
/*    */   {
/* 78 */     this.flinkService.update(this.flink);
/* 79 */     ActionContext.getContext().put("message", "更新成功");
/* 80 */     ActionContext.getContext().put("urladdress", "/control/flink/index");
/*    */ 
/* 82 */     return "message";
/*    */   }
/*    */ 
/*    */   public String delete() {
/* 86 */     this.flinkService.delete(new Serializable[] { this.flink.getId() });
/* 87 */     ActionContext.getContext().put("message", "删除成功");
/* 88 */     ActionContext.getContext().put("urladdress", "/control/flink/index");
/* 89 */     return "message";
/*    */   }
/*    */ }

/* Location:           C:\work\apache-tomcat-7.0.55\webapps\ROOT\WEB-INF\classes\
 * Qualified Name:     com.wzh.action.control.links.FlinkAction
 * JD-Core Version:    0.6.1
 */